﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;

public class BasePanel : MonoBehaviour {
    protected CanvasGroup canvasGroup;
    virtual protected void OnEnter()
    {
        Debug.Log("OnEnter");
        canvasGroup = gameObject.AddComponent<CanvasGroup>();
        transform.localScale = Vector3.zero;
        transform.DOScale(1,0.5f);
    }
    virtual protected void OnPause()
    {
        Debug.Log("OnPause");
        canvasGroup.blocksRaycasts = false;
    }
    virtual protected void OnResume()
    {
        Debug.Log("OnResume");
        canvasGroup.blocksRaycasts = true;
    }
    virtual protected void OnExit()
    {
        Debug.Log("OnExit");
    }
    virtual protected void PopPanel()
    {
        UIManager.Instance.popPanel();
    }
    virtual protected void OnClose()
    {
        transform.DOScale(0, 0.2f).OnComplete(PopPanel);
    }
}
